#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QPushButton>
#include <QGridLayout>
#include <QLabel>
#include <QMessageBox>
#include <QStack>
#include "GameModel.h"
#include "settingswindow.h" // 包含设置窗口头文件

QT_BEGIN_NAMESPACE
namespace Ui {
class MainWindow;
}
QT_END_NAMESPACE

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();

private:
    Ui::MainWindow *ui;

    GameModel *game;//游戏指针
    GameType game_type;//存储游戏类型

    int clickPosRow,clickPosCol;//存储将点击的位置
    bool selectPos = false;//是否移动到合适的位置，以选中某个交叉点

    //绘制
    void paintEvent(QPaintEvent *event);

    void initGame();
    void initAIGame();
    void initHumanVsHumanGame();

    void mouseMoveEvent(QMouseEvent *event);
    void mouseReleaseEvent(QMouseEvent *event);

    void chessOneByPerson();

    void setupUI();
    void setupMenuBar();
    void setupStatusBar();

    QWidget *centralWidget;
    QLabel *titleLabel;
    QPushButton *humanVsAIButton;
    QPushButton *humanVsHumanButton;
    QPushButton *settingsButton;
    QPushButton *helpButton;
    SettingsWindow *settingsWindow; // 设置窗口

private slots:
    void chessOneByAI();

    void onHumanVsAIButtonClicked();
    void onHumanVsHumanButtonClicked();
    void onSettingsButtonClicked();
    void onHelpButtonClicked();
    void onAboutActionTriggered();
    void onNewGameActionTriggered();
};
#endif // MAINWINDOW_H
